自定义NSError

domain:错误域 
code:错误编码
userInfo:错误原因

NSString *domain = @"xxxxxx";
NSString *desc = NSLocalizedString(@"xxx", @"xxx");//NSLocalizedString国际化
NSDictionary *userInfo = @{NSLocalizedDescriptionKey : desc };

NSError *error = [NSError errorWithDomain:domain code:-101 userInfo:userInfo];

 

posted @ 2019-05-07 13:37  Belinda_sl  阅读(1113)  评论(0编辑  收藏  举报